fix(input): allow escape as a prefix-mode keybinding - #2322
Conversation
Prefix mode always canceled on Esc before binding lookup, so configs like copy_mode = "prefix+esc" (tmux bind Escape copy-mode) never ran. Unbound Esc still cancels prefix mode via the unmatched-key path.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughEscape now supports configured prefix-mode bindings through ChangesEscape prefix bindings
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant PrefixMode
participant KeybindingResolver
participant CopyMode
User->>PrefixMode: Press prefix then Escape
PrefixMode->>KeybindingResolver: Resolve configured Escape binding
KeybindingResolver->>CopyMode: Execute copy-mode action
PrefixMode-->>User: Exit prefix mode when Escape is unbound
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR allows Escape to participate in normal prefix-mode keybinding dispatch while preserving cancellation for unbound Escape.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/app/input/navigate.rs | Reorders prefix-mode Escape handling so configured actions run before the existing fallback that leaves prefix mode, with tests for bound and unbound behavior. |
| src/config/keybinds.rs | Adds configuration tests confirming that case variants of both esc and escape resolve to an Escape prefix trigger. |
| docs/next/website/src/content/docs/configuration.mdx | Documents Escape aliases and the distinction between bound prefix actions and unbound cancellation. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Escape pressed in prefix mode] --> B{Prefix binding matches Escape?}
B -->|Yes| C[Execute configured action]
B -->|No| D[Leave prefix mode]
Reviews (3): Last reviewed commit: "Merge branch 'master' into fix/prefix-es..." | Re-trigger Greptile
Hey!
Esc always canceled prefix mode before keybinds ran, so copy_mode = "prefix+esc" (like tmux bind Escape copy-mode) never worked even though the config accepted it.
This treats Esc as a normal prefix RHS when bound; unbound Esc still cancels prefix mode.
Happy to adjust anything if needed.